using System;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using ActiproSoftware.Products.SyntaxEditor;
using ActiproSoftware.SyntaxEditor;
using ActiproSoftware.WinUICore;

namespace DukeyCssFetch
{
	// Token: 0x02000032 RID: 50
	public class FindReplaceForm : Form
	{
		// Token: 0x060001F3 RID: 499 RVA: 0x000174D4 File Offset: 0x000156D4
		public FindReplaceForm(SyntaxEditor syntaxEditor, FindReplaceOptions options)
		{
			
			this.InitializeComponent();
			if (options == null)
			{
				throw new ArgumentNullException("options");
			}
			this.syntaxEditor_0 = syntaxEditor;
			this.findReplaceOptions_0 = options;
			this.searchTypeDropDownList.Items.AddRange(new object[]
			{
				AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_SearchTypeDropDownList_Item_RegularExpressions"),
				AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_SearchTypeDropDownList_Item_Wildcards")
			});
			this.searchTypeDropDownList.SelectedIndex = 0;
			this.method_2();
		}

		// Token: 0x060001F6 RID: 502 RVA: 0x000180D8 File Offset: 0x000162D8
		private void closeButton_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		// Token: 0x060001F4 RID: 500 RVA: 0x00017568 File Offset: 0x00015768
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.container_0 != null)
			{
				this.container_0.Dispose();
			}
			base.Dispose(disposing);
		}

		// Token: 0x060001F7 RID: 503 RVA: 0x000180E0 File Offset: 0x000162E0
		private void findButton_Click(object sender, EventArgs e)
		{
			this.method_1();
			if (this.syntaxEditor_0 == null)
			{
				return;
			}
			this.OnStatusChanged(new FindReplaceStatusChangeEventArgs(FindReplaceStatusChangeType.Find, this.findReplaceOptions_0));
			FindReplaceResultSet findReplaceResultSet;
			try
			{
				findReplaceResultSet = this.syntaxEditor_0.SelectedView.FindReplace.Find(this.findReplaceOptions_0);
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Error_Message") + "\r\n" + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
				return;
			}
			if (findReplaceResultSet.PastDocumentEnd)
			{
				this.OnStatusChanged(new FindReplaceStatusChangeEventArgs(FindReplaceStatusChangeType.PastDocumentEnd, this.findReplaceOptions_0));
			}
			if (!findReplaceResultSet.PastSearchStartOffset)
			{
				if (findReplaceResultSet.Count == 0)
				{
					MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_NotFound_Message"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				}
				return;
			}
			MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_PastSearchStartOffset_Message"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
		}

		// Token: 0x060001F9 RID: 505 RVA: 0x0001825C File Offset: 0x0001645C
		private void findInsertButton_Click(object sender, EventArgs e)
		{
			OwnerDrawContextMenu ownerDrawContextMenu = new OwnerDrawContextMenu();
			if (this.searchTypeDropDownList.SelectedIndex == 0)
			{
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_SingleCharacter"), -1, new EventHandler(this.method_0), Shortcut.None, "."));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_ZeroOrMore"), -1, new EventHandler(this.method_0), Shortcut.None, "*"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneOrMore"), -1, new EventHandler(this.method_0), Shortcut.None, "+"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem("-"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_BeginningOfLine"), -1, new EventHandler(this.method_0), Shortcut.None, "^"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_EndOfLine"), -1, new EventHandler(this.method_0), Shortcut.None, "$"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_WordBoundary"), -1, new EventHandler(this.method_0), Shortcut.None, "\\b"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Whitespace"), -1, new EventHandler(this.method_0), Shortcut.None, "\\s"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_LineBreak"), -1, new EventHandler(this.method_0), Shortcut.None, "\\n"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem("-"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneCharacterInSet"), -1, new EventHandler(this.method_0), Shortcut.None, "[ ]"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneCharacterNotInSet"), -1, new EventHandler(this.method_0), Shortcut.None, "[^ ]"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Or"), -1, new EventHandler(this.method_0), Shortcut.None, "|"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_CharacterEscape"), -1, new EventHandler(this.method_0), Shortcut.None, "\\"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Group"), -1, new EventHandler(this.method_0), Shortcut.None, "( )"));
			}
			else
			{
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_ZeroOrMore"), -1, new EventHandler(this.method_0), Shortcut.None, "*"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_AnySingleCharacter"), -1, new EventHandler(this.method_0), Shortcut.None, "?"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_AnySingleDigit"), -1, new EventHandler(this.method_0), Shortcut.None, "#"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_OneCharacterInSet"), -1, new EventHandler(this.method_0), Shortcut.None, "[ ]"));
				ownerDrawContextMenu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_OneCharacterNotInSet"), -1, new EventHandler(this.method_0), Shortcut.None, "[! ]"));
			}
			ownerDrawContextMenu.Show(this.findInsertButton, new Point(this.findInsertButton.ClientRectangle.Right, this.findInsertButton.ClientRectangle.Top));
		}

		// Token: 0x060001F8 RID: 504 RVA: 0x000181E4 File Offset: 0x000163E4
		private void findTextBox_TextChanged(object sender, EventArgs e)
		{
			this.findButton.Enabled = (this.findTextBox.Text.Length > 0);
			this.replaceButton.Enabled = this.findButton.Enabled;
			this.replaceAllButton.Enabled = (this.findTextBox.Text.Length > 0);
			this.markAllButton.Enabled = this.replaceAllButton.Enabled;
		}

		// Token: 0x060001F5 RID: 501 RVA: 0x00017588 File Offset: 0x00015788
		private void InitializeComponent()
		{
			this.findTextBox = new TextBox();
			this.findButton = new Button();
			this.findWhatLabel = new Label();
			this.searchTypeCheckBox = new CheckBox();
			this.searchTypeDropDownList = new ComboBox();
			this.matchCaseCheckBox = new CheckBox();
			this.matchWholeWordCheckBox = new CheckBox();
			this.searchUpCheckBox = new CheckBox();
			this.replaceButton = new Button();
			this.replaceAllButton = new Button();
			this.markAllButton = new Button();
			this.closeButton = new Button();
			this.replaceWithLabel = new Label();
			this.replaceTextBox = new TextBox();
			this.markWithCheckBox = new CheckBox();
			this.searchInSelectionCheckBox = new CheckBox();
			this.searchHiddenTextCheckBox = new CheckBox();
			this.findInsertButton = new Button();
			base.SuspendLayout();
			this.findTextBox.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.findTextBox.Location = new Point(121, 9);
			this.findTextBox.Name = "findTextBox";
			this.findTextBox.Size = new Size(201, 21);
			this.findTextBox.TabIndex = 1;
			this.findTextBox.TextChanged += new EventHandler(this.findTextBox_TextChanged);
			this.findButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.findButton.Enabled = false;
			this.findButton.FlatStyle = FlatStyle.System;
			this.findButton.Location = new Point(358, 9);
			this.findButton.Name = "findButton";
			this.findButton.Size = new Size(90, 24);
			this.findButton.TabIndex = 13;
			this.findButton.Text = "查找下一个(&F)";
			this.findButton.Click += new EventHandler(this.findButton_Click);
			this.findWhatLabel.AutoSize = true;
			this.findWhatLabel.Location = new Point(10, 11);
			this.findWhatLabel.Name = "findWhatLabel";
			this.findWhatLabel.Size = new Size(59, 12);
			this.findWhatLabel.TabIndex = 0;
			this.findWhatLabel.Text = "查找内容:";
			this.searchTypeCheckBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.searchTypeCheckBox.FlatStyle = FlatStyle.System;
			this.searchTypeCheckBox.Location = new Point(13, 154);
			this.searchTypeCheckBox.Name = "searchTypeCheckBox";
			this.searchTypeCheckBox.Size = new Size(70, 26);
			this.searchTypeCheckBox.TabIndex = 8;
			this.searchTypeCheckBox.Text = "使用";
			this.searchTypeCheckBox.CheckedChanged += new EventHandler(this.searchTypeCheckBox_CheckedChanged);
			this.searchTypeDropDownList.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.searchTypeDropDownList.DropDownStyle = ComboBoxStyle.DropDownList;
			this.searchTypeDropDownList.Enabled = false;
			this.searchTypeDropDownList.Location = new Point(61, 157);
			this.searchTypeDropDownList.Name = "searchTypeDropDownList";
			this.searchTypeDropDownList.Size = new Size(320, 20);
			this.searchTypeDropDownList.TabIndex = 9;
			this.matchCaseCheckBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.matchCaseCheckBox.FlatStyle = FlatStyle.System;
			this.matchCaseCheckBox.Location = new Point(13, 83);
			this.matchCaseCheckBox.Name = "matchCaseCheckBox";
			this.matchCaseCheckBox.Size = new Size(104, 25);
			this.matchCaseCheckBox.TabIndex = 5;
			this.matchCaseCheckBox.Text = "大小写匹配(&C)";
			this.matchWholeWordCheckBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.matchWholeWordCheckBox.FlatStyle = FlatStyle.System;
			this.matchWholeWordCheckBox.Location = new Point(13, 105);
			this.matchWholeWordCheckBox.Name = "matchWholeWordCheckBox";
			this.matchWholeWordCheckBox.Size = new Size(127, 26);
			this.matchWholeWordCheckBox.TabIndex = 6;
			this.matchWholeWordCheckBox.Text = "全字匹配(&W)";
			this.searchUpCheckBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.searchUpCheckBox.FlatStyle = FlatStyle.System;
			this.searchUpCheckBox.Location = new Point(13, 128);
			this.searchUpCheckBox.Name = "searchUpCheckBox";
			this.searchUpCheckBox.Size = new Size(104, 26);
			this.searchUpCheckBox.TabIndex = 7;
			this.searchUpCheckBox.Text = "向上搜索(&U)";
			this.replaceButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.replaceButton.Enabled = false;
			this.replaceButton.FlatStyle = FlatStyle.System;
			this.replaceButton.Location = new Point(358, 37);
			this.replaceButton.Name = "replaceButton";
			this.replaceButton.Size = new Size(90, 24);
			this.replaceButton.TabIndex = 14;
			this.replaceButton.Text = "替换(&R)";
			this.replaceButton.Click += new EventHandler(this.replaceButton_Click);
			this.replaceAllButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.replaceAllButton.Enabled = false;
			this.replaceAllButton.FlatStyle = FlatStyle.System;
			this.replaceAllButton.Location = new Point(358, 66);
			this.replaceAllButton.Name = "replaceAllButton";
			this.replaceAllButton.Size = new Size(90, 24);
			this.replaceAllButton.TabIndex = 15;
			this.replaceAllButton.Text = "替换所有";
			this.replaceAllButton.Click += new EventHandler(this.replaceAllButton_Click);
			this.markAllButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.markAllButton.Enabled = false;
			this.markAllButton.FlatStyle = FlatStyle.System;
			this.markAllButton.Location = new Point(358, 95);
			this.markAllButton.Name = "markAllButton";
			this.markAllButton.Size = new Size(90, 25);
			this.markAllButton.TabIndex = 16;
			this.markAllButton.Text = "标记所有";
			this.markAllButton.Click += new EventHandler(this.markAllButton_Click);
			this.closeButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.closeButton.DialogResult = DialogResult.Cancel;
			this.closeButton.FlatStyle = FlatStyle.System;
			this.closeButton.Location = new Point(358, 124);
			this.closeButton.Name = "closeButton";
			this.closeButton.Size = new Size(90, 25);
			this.closeButton.TabIndex = 17;
			this.closeButton.Text = "关闭";
			this.closeButton.Click += new EventHandler(this.closeButton_Click);
			this.replaceWithLabel.AutoSize = true;
			this.replaceWithLabel.Location = new Point(10, 39);
			this.replaceWithLabel.Name = "replaceWithLabel";
			this.replaceWithLabel.Size = new Size(47, 12);
			this.replaceWithLabel.TabIndex = 3;
			this.replaceWithLabel.Text = "替换为:";
			this.replaceTextBox.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.replaceTextBox.Location = new Point(121, 36);
			this.replaceTextBox.Name = "replaceTextBox";
			this.replaceTextBox.Size = new Size(227, 21);
			this.replaceTextBox.TabIndex = 4;
			this.markWithCheckBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.markWithCheckBox.Checked = true;
			this.markWithCheckBox.CheckState = CheckState.Checked;
			this.markWithCheckBox.FlatStyle = FlatStyle.System;
			this.markWithCheckBox.Location = new Point(147, 129);
			this.markWithCheckBox.Name = "markWithCheckBox";
			this.markWithCheckBox.Size = new Size(187, 26);
			this.markWithCheckBox.TabIndex = 12;
			this.markWithCheckBox.Text = "标记为标签";
			this.markWithCheckBox.Visible = false;
			this.searchInSelectionCheckBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.searchInSelectionCheckBox.FlatStyle = FlatStyle.System;
			this.searchInSelectionCheckBox.Location = new Point(147, 106);
			this.searchInSelectionCheckBox.Name = "searchInSelectionCheckBox";
			this.searchInSelectionCheckBox.Size = new Size(187, 26);
			this.searchInSelectionCheckBox.TabIndex = 11;
			this.searchInSelectionCheckBox.Text = "搜索选定文本";
			this.searchHiddenTextCheckBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.searchHiddenTextCheckBox.Checked = true;
			this.searchHiddenTextCheckBox.CheckState = CheckState.Checked;
			this.searchHiddenTextCheckBox.FlatStyle = FlatStyle.System;
			this.searchHiddenTextCheckBox.Location = new Point(147, 84);
			this.searchHiddenTextCheckBox.Name = "searchHiddenTextCheckBox";
			this.searchHiddenTextCheckBox.Size = new Size(187, 25);
			this.searchHiddenTextCheckBox.TabIndex = 10;
			this.searchHiddenTextCheckBox.Text = "搜索隐藏文本(&H)";
			this.findInsertButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.findInsertButton.Enabled = false;
			this.findInsertButton.FlatStyle = FlatStyle.System;
			this.findInsertButton.Location = new Point(325, 8);
			this.findInsertButton.Name = "findInsertButton";
			this.findInsertButton.Size = new Size(24, 23);
			this.findInsertButton.TabIndex = 2;
			this.findInsertButton.Text = ">";
			this.findInsertButton.Click += new EventHandler(this.findInsertButton_Click);
			base.AcceptButton = this.findButton;
			this.AutoScaleBaseSize = new Size(6, 14);
			base.CancelButton = this.closeButton;
			base.ClientSize = new Size(457, 186);
			base.Controls.Add(this.findInsertButton);
			base.Controls.Add(this.searchHiddenTextCheckBox);
			base.Controls.Add(this.searchInSelectionCheckBox);
			base.Controls.Add(this.markWithCheckBox);
			base.Controls.Add(this.replaceWithLabel);
			base.Controls.Add(this.findWhatLabel);
			base.Controls.Add(this.replaceTextBox);
			base.Controls.Add(this.closeButton);
			base.Controls.Add(this.markAllButton);
			base.Controls.Add(this.replaceAllButton);
			base.Controls.Add(this.replaceButton);
			base.Controls.Add(this.searchUpCheckBox);
			base.Controls.Add(this.matchWholeWordCheckBox);
			base.Controls.Add(this.matchCaseCheckBox);
			base.Controls.Add(this.searchTypeDropDownList);
			base.Controls.Add(this.searchTypeCheckBox);
			base.Controls.Add(this.findButton);
			base.Controls.Add(this.findTextBox);
			base.FormBorderStyle = FormBorderStyle.FixedDialog;
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "FindReplaceForm";
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "查找/替换";
			base.ResumeLayout(false);
			base.PerformLayout();
		}

		// Token: 0x060001FA RID: 506 RVA: 0x000186D8 File Offset: 0x000168D8
		private void markAllButton_Click(object sender, EventArgs e)
		{
			this.method_1();
			if (this.syntaxEditor_0 == null)
			{
				return;
			}
			FindReplaceResultSet findReplaceResultSet;
			try
			{
				if (this.markWithCheckBox.Checked)
				{
					findReplaceResultSet = this.syntaxEditor_0.SelectedView.FindReplace.MarkAll(this.findReplaceOptions_0);
				}
				else
				{
					findReplaceResultSet = this.syntaxEditor_0.SelectedView.FindReplace.MarkAll(this.findReplaceOptions_0, typeof(GrammarErrorSpanIndicator));
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Error_Message") + "\r\n" + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
				return;
			}
			if (findReplaceResultSet.Count == 0)
			{
				MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_NotFound_Message"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
			}
		}

		// Token: 0x060001FB RID: 507 RVA: 0x000187B8 File Offset: 0x000169B8
		private void method_0(object sender, EventArgs e)
		{
			this.findTextBox.SelectedText = ((OwnerDrawMenuItem)sender).Tag.ToString();
		}

		// Token: 0x060001FF RID: 511 RVA: 0x000189F8 File Offset: 0x00016BF8
		private void method_1()
		{
			this.findReplaceOptions_0.FindText = this.findTextBox.Text;
			this.findReplaceOptions_0.ReplaceText = this.replaceTextBox.Text;
			this.findReplaceOptions_0.MatchCase = this.matchCaseCheckBox.Checked;
			this.findReplaceOptions_0.MatchWholeWord = this.matchWholeWordCheckBox.Checked;
			this.findReplaceOptions_0.SearchHiddenText = this.searchHiddenTextCheckBox.Checked;
			this.findReplaceOptions_0.SearchInSelection = this.searchInSelectionCheckBox.Checked;
			this.findReplaceOptions_0.SearchUp = this.searchUpCheckBox.Checked;
			this.findReplaceOptions_0.SearchType = ((!this.searchTypeCheckBox.Checked) ? FindReplaceSearchType.Normal : ((this.searchTypeDropDownList.SelectedIndex == 0) ? FindReplaceSearchType.RegularExpression : FindReplaceSearchType.Wildcard));
		}

		// Token: 0x06000200 RID: 512 RVA: 0x00018ACC File Offset: 0x00016CCC
		private void method_2()
		{
			this.findTextBox.Text = this.findReplaceOptions_0.FindText;
			this.replaceTextBox.Text = this.findReplaceOptions_0.ReplaceText;
			this.matchCaseCheckBox.Checked = this.findReplaceOptions_0.MatchCase;
			this.matchWholeWordCheckBox.Checked = this.findReplaceOptions_0.MatchWholeWord;
			this.searchUpCheckBox.Checked = this.findReplaceOptions_0.SearchUp;
			this.searchHiddenTextCheckBox.Checked = this.findReplaceOptions_0.SearchHiddenText;
			this.searchInSelectionCheckBox.Checked = this.findReplaceOptions_0.SearchInSelection;
			this.searchTypeCheckBox.Checked = (this.findReplaceOptions_0.SearchType != FindReplaceSearchType.Normal);
			this.searchTypeDropDownList.SelectedIndex = ((this.findReplaceOptions_0.SearchType != FindReplaceSearchType.Wildcard) ? 0 : 1);
		}

		// Token: 0x06000201 RID: 513 RVA: 0x00018BAC File Offset: 0x00016DAC
		protected override void OnActivated(EventArgs e)
		{
			base.OnActivated(e);
			this.findTextBox.SelectAll();
			this.findTextBox.Focus();
		}

		// Token: 0x06000202 RID: 514 RVA: 0x00018BCC File Offset: 0x00016DCC
		protected override void OnClosing(CancelEventArgs e)
		{
			this.OnStatusChanged(new FindReplaceStatusChangeEventArgs(FindReplaceStatusChangeType.Ready, this.findReplaceOptions_0));
			base.OnClosing(e);
			e.Cancel = true;
			if (base.Owner != null)
			{
				base.Owner.Activate();
			}
			base.Hide();
		}

		// Token: 0x06000203 RID: 515 RVA: 0x00018C08 File Offset: 0x00016E08
		protected virtual void OnStatusChanged(FindReplaceStatusChangeEventArgs e)
		{
			if (this.findReplaceStatusChangeEventHandler_0 != null)
			{
				this.findReplaceStatusChangeEventHandler_0(this, e);
			}
		}

		// Token: 0x06000204 RID: 516 RVA: 0x00018C20 File Offset: 0x00016E20
		protected override void OnVisibleChanged(EventArgs e)
		{
			base.OnVisibleChanged(e);
			if (base.Visible)
			{
				this.method_2();
			}
		}

		// Token: 0x060001FD RID: 509 RVA: 0x000188E4 File Offset: 0x00016AE4
		private void replaceAllButton_Click(object sender, EventArgs e)
		{
			this.method_1();
			if (this.syntaxEditor_0 == null)
			{
				return;
			}
			FindReplaceResultSet findReplaceResultSet;
			try
			{
				findReplaceResultSet = this.syntaxEditor_0.SelectedView.FindReplace.ReplaceAll(this.findReplaceOptions_0);
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Error_Message") + "\r\n" + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
				return;
			}
			if (findReplaceResultSet.Count != 0)
			{
				MessageBox.Show(this, findReplaceResultSet.Count + " " + AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_OccurrencesReplaced_Message"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				return;
			}
			MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_NotFound_Message"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
		}

		// Token: 0x060001FC RID: 508 RVA: 0x000187D8 File Offset: 0x000169D8
		private void replaceButton_Click(object sender, EventArgs e)
		{
			this.method_1();
			if (this.syntaxEditor_0 == null)
			{
				return;
			}
			this.OnStatusChanged(new FindReplaceStatusChangeEventArgs(FindReplaceStatusChangeType.Replace, this.findReplaceOptions_0));
			FindReplaceResultSet findReplaceResultSet;
			try
			{
				findReplaceResultSet = this.syntaxEditor_0.SelectedView.FindReplace.Replace(this.findReplaceOptions_0);
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Error_Message") + "\r\n" + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
				return;
			}
			if (findReplaceResultSet.PastDocumentEnd)
			{
				this.OnStatusChanged(new FindReplaceStatusChangeEventArgs(FindReplaceStatusChangeType.PastDocumentEnd, this.findReplaceOptions_0));
			}
			if (findReplaceResultSet.Count == 0)
			{
				if (findReplaceResultSet.PastDocumentEnd && findReplaceResultSet.ReplaceOccurred)
				{
					MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_PastSearchStartOffset_Message"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
					return;
				}
				MessageBox.Show(this, AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_NotFound_Message"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
			}
		}

		// Token: 0x060001FE RID: 510 RVA: 0x000189C8 File Offset: 0x00016BC8
		private void searchTypeCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.findInsertButton.Enabled = this.searchTypeCheckBox.Checked;
			this.searchTypeDropDownList.Enabled = this.searchTypeCheckBox.Checked;
		}

		// Token: 0x1700002B RID: 43
		public FindReplaceOptions Options
		{
			// Token: 0x06000205 RID: 517 RVA: 0x00018C38 File Offset: 0x00016E38
			get
			{
				return this.findReplaceOptions_0;
			}
			// Token: 0x06000206 RID: 518 RVA: 0x00018C40 File Offset: 0x00016E40
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("Options");
				}
				this.findReplaceOptions_0 = value;
				this.method_2();
			}
		}

		// Token: 0x1700002C RID: 44
		public SyntaxEditor SyntaxEditor
		{
			// Token: 0x06000207 RID: 519 RVA: 0x00018C60 File Offset: 0x00016E60
			get
			{
				return this.syntaxEditor_0;
			}
			// Token: 0x06000208 RID: 520 RVA: 0x00018C68 File Offset: 0x00016E68
			set
			{
				this.syntaxEditor_0 = value;
			}
		}

		// Token: 0x1400000A RID: 10
		[Category("Action"), Description("Occurs when there is a status change.")]
		public event FindReplaceStatusChangeEventHandler StatusChanged
		{
			// Token: 0x060001F1 RID: 497 RVA: 0x00017464 File Offset: 0x00015664
			add
			{
				FindReplaceStatusChangeEventHandler findReplaceStatusChangeEventHandler = this.findReplaceStatusChangeEventHandler_0;
				FindReplaceStatusChangeEventHandler findReplaceStatusChangeEventHandler2;
				do
				{
					findReplaceStatusChangeEventHandler2 = findReplaceStatusChangeEventHandler;
					FindReplaceStatusChangeEventHandler value2 = (FindReplaceStatusChangeEventHandler)Delegate.Combine(findReplaceStatusChangeEventHandler2, value);
					findReplaceStatusChangeEventHandler = Interlocked.CompareExchange<FindReplaceStatusChangeEventHandler>(ref this.findReplaceStatusChangeEventHandler_0, value2, findReplaceStatusChangeEventHandler2);
				}
				while (findReplaceStatusChangeEventHandler != findReplaceStatusChangeEventHandler2);
			}
			// Token: 0x060001F2 RID: 498 RVA: 0x0001749C File Offset: 0x0001569C
			remove
			{
				FindReplaceStatusChangeEventHandler findReplaceStatusChangeEventHandler = this.findReplaceStatusChangeEventHandler_0;
				FindReplaceStatusChangeEventHandler findReplaceStatusChangeEventHandler2;
				do
				{
					findReplaceStatusChangeEventHandler2 = findReplaceStatusChangeEventHandler;
					FindReplaceStatusChangeEventHandler value2 = (FindReplaceStatusChangeEventHandler)Delegate.Remove(findReplaceStatusChangeEventHandler2, value);
					findReplaceStatusChangeEventHandler = Interlocked.CompareExchange<FindReplaceStatusChangeEventHandler>(ref this.findReplaceStatusChangeEventHandler_0, value2, findReplaceStatusChangeEventHandler2);
				}
				while (findReplaceStatusChangeEventHandler != findReplaceStatusChangeEventHandler2);
			}
		}

		// Token: 0x0400020C RID: 524
		private Button closeButton;

		// Token: 0x04000213 RID: 531
		private Container container_0;

		// Token: 0x04000202 RID: 514
		private Button findButton;

		// Token: 0x04000212 RID: 530
		private Button findInsertButton;

		// Token: 0x040001FF RID: 511
		private FindReplaceOptions findReplaceOptions_0;

		// Token: 0x04000214 RID: 532
		private FindReplaceStatusChangeEventHandler findReplaceStatusChangeEventHandler_0;

		// Token: 0x04000201 RID: 513
		private TextBox findTextBox;

		// Token: 0x04000203 RID: 515
		private Label findWhatLabel;

		// Token: 0x0400020B RID: 523
		private Button markAllButton;

		// Token: 0x0400020F RID: 527
		private CheckBox markWithCheckBox;

		// Token: 0x04000206 RID: 518
		private CheckBox matchCaseCheckBox;

		// Token: 0x04000207 RID: 519
		private CheckBox matchWholeWordCheckBox;

		// Token: 0x0400020A RID: 522
		private Button replaceAllButton;

		// Token: 0x04000209 RID: 521
		private Button replaceButton;

		// Token: 0x0400020E RID: 526
		private TextBox replaceTextBox;

		// Token: 0x0400020D RID: 525
		private Label replaceWithLabel;

		// Token: 0x04000211 RID: 529
		private CheckBox searchHiddenTextCheckBox;

		// Token: 0x04000210 RID: 528
		private CheckBox searchInSelectionCheckBox;

		// Token: 0x04000204 RID: 516
		private CheckBox searchTypeCheckBox;

		// Token: 0x04000205 RID: 517
		private ComboBox searchTypeDropDownList;

		// Token: 0x04000208 RID: 520
		private CheckBox searchUpCheckBox;

		// Token: 0x04000200 RID: 512
		private SyntaxEditor syntaxEditor_0;
	}
}
